home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 2.8 KB | 107 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWProfiler.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993-1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWPROFILER_H
- #include "FWProfiler.h"
- #endif
-
- #ifndef __PROFILER__
- #include <Profiler.h>
- #endif
-
- #ifndef __FOLDERS__
- #include <Folders.h>
- #endif
-
- #include <string.h>
-
- static Str255 gDumpFile;
-
- //----------------------------------------------------------------------------------------
- // FW_ProfilerGetStatus
- //----------------------------------------------------------------------------------------
-
- short FW_ProfilerGetStatus()
- {
- return ProfilerGetStatus();
- }
-
- //----------------------------------------------------------------------------------------
- // FW_ProfilerSetStatus
- //----------------------------------------------------------------------------------------
-
- void FW_ProfilerSetStatus(short on)
- {
- ProfilerSetStatus(on);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_ProfilerSetDumpFile
- //----------------------------------------------------------------------------------------
-
- void FW_ProfilerSetDumpFile(ConstStr255Param newFile)
- {
- memcpy(gDumpFile, newFile, newFile[0] + 1);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_ProfilerUseDefaultDumpFile
- //----------------------------------------------------------------------------------------
-
- void FW_ProfilerUseDefaultDumpFile()
- {
- short bootVRefNum;
- long systemFolder;
- OSErr err;
- Str255 newFile;
-
- static char gDefaultFile[] = "\pODFProfilerDump";
-
- newFile[0] = 0;
-
- err = FindFolder(kOnSystemDisk, kSystemFolderType, false, &bootVRefNum, &systemFolder);
- if (err == noErr)
- {
- CInfoPBRec cpb;
- cpb.dirInfo.ioNamePtr = newFile;
- cpb.dirInfo.ioVRefNum = bootVRefNum;
- cpb.dirInfo.ioFDirIndex = -1;
- cpb.dirInfo.ioDrDirID = 2;
-
- err = PBGetCatInfoSync(&cpb);
- if (err == noErr)
- newFile[++newFile[0]] = ':';
- }
-
- memcpy(newFile + newFile[0] + 1, gDefaultFile + 1, gDefaultFile[0]);
- newFile[0] += gDefaultFile[0];
- FW_ProfilerSetDumpFile(newFile);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_ProfilerDump
- //----------------------------------------------------------------------------------------
-
- OSErr FW_ProfilerDump()
- {
- if (!gDumpFile[0])
- FW_ProfilerUseDefaultDumpFile();
-
- return ProfilerDump(gDumpFile);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_ProfilerClear
- //----------------------------------------------------------------------------------------
-
- void FW_ProfilerClear()
- {
- ProfilerClear();
- }
-